const fs = require('fs');


function myReadFile(filename) {
    let p = new Promise((resolve, reject) => {
        fs.readFile(filename, 'utf-8', (err, data) => {
            err ? reject(err) : resolve(data.length);
        })
    })
    return p;
}


myReadFile('./files/a.txt').then(result => {
    console.log(result);
    return myReadFile('./files/b.txt')
}).then(result => {
    console.log(result);
    return myReadFile('./files/c.txt')
}).then(result => {
    console.log(result);
}).catch(err => {
    console.log(err);
})